var APP = {title: 'Rolloshop .. '};

$EL = function(element_name) {
  var nodeName = element_name.replace(/([\[\]\|])/g, '\\$1');
  return jQuery(nodeName);
}

var itd_UtilAlert = {
  debug: function(msg) {
    alert(msg);
  },

  alert: function(msg) {
    if ((typeof dhtmlx.message) != "undefined") 
      dhtmlx.alert({title:APP.title, text:msg});
    else 
      this.alert(msg);
  },

  info: function(msg) {
    if ((typeof dhtmlx.message) != "undefined") 
      dhtmlx.alert({title:APP.title, text:"<img src='/images/icons/bell_error.png'>" + msg });
    else 
      this.alert("INFO: " + msg);
  },

  error: function(msg) {
    if ((typeof dhtmlx.message) != "undefined") 
      dhtmlx.alert({type:"alert-error", title:APP.title, text: msg });
    else 
      this.alert("FEHLER:" + msg);
  },
  
  confirm: function(msg, btnLabels, fn_cb) {
    if ((typeof dhtmlx.message) == "undefined") 
      return confirm(msg);
    else {
      var btn = btnLabels||["Ja", "Nein"];
      dhtmlx.confirm({
        title: APP.title,
        ok: btn[0], cancel: btn[1],
        text: msg,
        callback:function(resp){ 
          if (resp == true) fn_cb(); 
        }
      });
    }
  }
  
};

(function($){
  $.array_unique = function(arr){
    return $.grep(arr, function(v, k) {
      return $.inArray(v ,arr) === k;
    });
  };
})(jQuery);

